{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Interpolation Error"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "import numpy.linalg as la\n",
        "import matplotlib.pyplot as pt"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Let's fix a function to interpolate:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "if 1:\n",
        "    def f(x):\n",
        "        return np.exp(1.5*x)\n",
        "elif 0:\n",
        "    def f(x):\n",
        "        return np.sin(20*x)\n",
        "else:\n",
        "    def f(x):\n",
        "        return (x>=0.5).astype(np.int).astype(np.float)\n",
        "    "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "[<matplotlib.lines.Line2D at 0x7f1b5180f240>]"
            ]
          },
          "execution_count": 3,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAEACAYAAABWLgY0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHk9JREFUeJzt3XmYVNWZx/HvCwq4oIY4QAYibhjFmIDOKC6RcpdFIApu\nqKioKC7M5NGMYiKNZsYlRhSXKAIKCCJgREAZQaHYQQR6BAHF0YgOCsqmgEGWd/44pUBbTVd3Lbe6\n6vd5nn5S3XW76vWm+fXp955zrrk7IiJSmGpEXYCIiGSPQl5EpIAp5EVECphCXkSkgCnkRUQKmEJe\nRKSApRzyZlbDzBaY2dgkz3U1s9WJ5xeY2bWZLVNERKpir0oc2xNYAhxQzvMj3P229EsSEZFMSWkk\nb2aNgTbAgD0dlpGKREQkY1Jt1/QF7gD2tDz2QjMrNbORiV8KIiISsQpD3szaAqvcvZ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pz9TqqtUzgVmdjZwF3BB4k/WQlTRuahL+IcbN7OPgZbAqwV68TWVn4vPgFfdfYe7\n/x14H2iam/JyKpVz0Q0YCeDuc4A6ZnZwbsrLK5+RyM2EpHlSVjZCfh5wpJk1MbNawKWEBVO7GsfO\nEVtnYHIW6sgHFZ4LM2tB2LmzvbuviaDGXNnjuXD3r929vrsf7u6HEa5PXODuCyKqN5tS+TcyBjgT\nIBFoTYGPclplbqRyLj4BzgYws2OA2gV8jaKihadXAVS08HRXGW/XuPt2M7sFmEj4JTLQ3ZeaWR9g\nnruPBwYCQ81sObCG8H9swUnxXDwE7AeMSrQsPnH3jtFVnR0pnovdvoUCbdekci7c/Q0zO9fM3gO2\nAbcX4l+7Kf5c3A48a2b/TrgI27X8V6y+srXwVIuhREQKmG6cJyJSwBTyIiIFTCEvIlLAFPIiIgVM\nIS8iUsAU8iIiBUwhLyJSwBTyIiIF7P8BN6Xn/aCLDaMAAAAASUVORK5CYII=\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7f1b540aa4e0>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "x_01 = np.linspace(0, 1, 1000)\n",
        "pt.plot(x_01, f(x_01))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "And let's fix some parameters. Note that the interpolation interval is just $[0,h]$, not $[0,1]$!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([ 0.,  1.])"
            ]
          },
          "execution_count": 4,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "degree = 1\n",
        "h = 1\n",
        "\n",
        "nodes = 0.5 + np.linspace(-h/2, h/2, degree+1)\n",
        "nodes"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Now build the Vandermonde matrix:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "V = np.array([\n",
        "    nodes**i\n",
        "    for i in range(degree+1)\n",
        "]).T"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([[ 1.,  0.],\n",
              "       [ 1.,  1.]])"
            ]
          },
          "execution_count": 6,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "V"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Now find the interpolation coefficients as `coeffs`:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "coeffs = la.solve(V, f(nodes))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Here are some points. Evaluate the interpolant there:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "x_0h = 0.5+np.linspace(-h/2, h/2, 1000)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "interp_0h = 0*x_0h\n",
        "for i in range(degree+1):\n",
        "    interp_0h += coeffs[i] * x_0h**i"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Now plot the interpolant with the function:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "<matplotlib.legend.Legend at 0x7f1b517bfa20>"
            ]
          },
          "execution_count": 10,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAEACAYAAABWLgY0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd4VHX2+PH3CdIEQpUO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Dqf17sCM3KetweW+nLcQFTy7YCNqrpNVbOACTgTps50K/BJ\nzvNJQKcAxBEKCrwWqrpAVdNzPlzKOeYYhDlffi4AXgb+BWQEM7gg8+Va3Ae8r6rHAFT1QJBjDBZf\nroUXiM55XglnLk7EUT9PPP1VIJJ87slROzk7cZ1uo6oe4IiIVAlALG7z5Vqc6V7g24BG5J4Cr0XO\nv591VXVmMANzgS8/F02BZiKySEQWi0jRd6sPTb5cixeBe0RkB/AN8EiQYgs15zXx9FeBWJfXl8lR\nudtIHm0igc8TxUTkbqAtTvdNJDrntRBnZ5e3gf4FvCcS+PJzcQFOl831QH3gBxG59NfKPoL4ci3u\nBMaq6ts5w7THAZcGPLLQc14TT38ViEp+J84P5a/qArtztdkB1AMQkRI4/Y7n+jclXPlyLRCRzsAz\nQI+cf1kjUUHXogLOL26CiGwBrgSmRejNV19+LnYC01TVq6pbgQ3AxcEJL6h8uRb3Al8CqOpSoIyI\nVAtOeCFlJzl5M0ee+SS3QCT5ZUATEYkRkVJAH5wJU2eazm8V2x3AvADEEQoKvBYi0gZn5c5bVPWg\nCzEGyzmvhaoeU9XqqtpIVRvi3J/ooaorXIo3kHz5HZkK/BEgJ6FdDGwOapTB4cu12AZ0BhCRS4DS\nEXyPoqCJp/0ACpp4eia/d9eoqkdEHgZm4/wRGaOq60TkRWCZqn4DjAE+E5GNwEGcb2zE8fFavIaz\npE98TpfFNlW9zb2oA8PHa/G7txCh3TW+XAtV/U5EuojIz0A28EQk/rfr48/FE8CHIvIYzk3Y/vkf\nMXwFauKpTYYyxpgIFpDJUMYYY0KDJXljjIlgluSNMSaCWZI3xpgIZkneGGMimCV5Y4yJYJbkjTEm\nglmSN8aYCPb/AVSEE+/blf8mAAAAAElFTkSuQmCC\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7f1b517d1f60>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "pt.plot(x_01, f(x_01), \"--\", color=\"gray\", label=\"$f$\")\n",
        "pt.plot(x_0h, interp_0h, color=\"red\", label=\"Interpolant\")\n",
        "pt.plot(nodes, f(nodes), \"or\")\n",
        "pt.legend(loc=\"best\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Also plot the error:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Max error: 0.633384\n"
          ]
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAEACAYAAABWLgY0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4lOXVx/HvAWRRcUXUgqAUBaVaQIv0rZYoLrGvinuD\nCyouqKVY3ICqF8EdUdG61I3WakXclYK4AVGsSqMgIrIWZXGBFyqiVrZwv3+cIDEkZEhm5p7l97mu\nuZzJPHnm8Dg5c8+5NwshICIiuale7ABERCR1lORFRHKYkryISA5TkhcRyWFK8iIiOUxJXkQkhyWU\n5M2s0MxmmdkcMxtQxfN3mNlUM5tiZrPN7D/JD1VERLaU1TRO3szqAXOA7sDnQClQFEKYVc3xfYGO\nIYTzkxyriIhsoURa8l2AuSGEBSGEtcAooMdmju8JPJGM4EREpG4SSfItgEUVHi8u/9kmzKwVsCcw\noc6RiYhInSWS5K2Kn1VX4ykCnglaK0FEJCM0SOCYxUCrCo9b4rX5qhQBl1R3IjNT8hcRqYUQQlUN\n7hol0pIvBdqaWWsza4gn8tGVDzKzdsAOIYR3awhUtxAYPHhw9Bgy5aZroWuha7H5W13UmORDCGVA\nX+BVYAYwKoQw08yGmNmxFQ4twjtlRUQkQyRSriGE8DLQrtLPBld6PCSJcYmISBJoxmskBQUFsUPI\nGLoWG+labKRrkRw1ToZK6ouZhXS+nohILjAzQgo7XkVEJEspyYuI5DAleRGRHKYkLyKSw5TkRURy\nmJK8iEgOU5IXEclhSvIiIjlMSV5EJI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nkRymJC8iksOU5EVEcpiSvIhIDlOSFxHJYUryIiI5TEleRCSH/T+9wH3CZf+0bgAAAABJRU5ErkJg\ngg==\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7f1b5170b2b0>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "error = interp_0h - f(x_0h)\n",
        "pt.plot(x_0h, error)\n",
        "print(\"Max error: %g\" % np.max(np.abs(error)))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "* What does the error look like? (Approximately)\n",
        "* How will the error react if we shrink the interval?\n",
        "* What will happen if we increase the polynomial degree?"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": true
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.5.1+"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}